MenuHostHelper
Helper class for implementing MenuHost. This class should be used to implement the MenuHost functions. i.e.:
class ExampleComponent : MenuHost {
private val menuHostHelper = MenuHostHelper{ invalidateMenu() }
override fun invalidateMenu() { … }
override fun addMenuProvider(provider: MenuProvider, owner: LifecycleOwner) {
menuHostHelper.addMenuProvider(provider, owner)
}
// Override remaining MenuHost methods in similar fashion
}
Content copied to clipboard
Functions
Link copied to clipboard
open fun addMenuProvider(@NonNull provider: @NonNull MenuProvider, @NonNull owner: @NonNull LifecycleOwner)
Adds the given MenuProvider to the helper.
open fun addMenuProvider(@NonNull provider: @NonNull MenuProvider, @NonNull owner: @NonNull LifecycleOwner, state: @NonNull Lifecycle.State)
Adds the given MenuProvider to the helper once the given LifecycleOwner reaches the given Lifecycle.State.
Link copied to clipboard
Link copied to clipboard
Called when the given Menu, which was provided by one of the current MenuProviders, is closed.
Link copied to clipboard
Called whenever one of the menu items from any of the current MenuProviders is selected.
Link copied to clipboard
Called right before the given Menu, which was provided by one of the current MenuProviders, is to be shown.
Link copied to clipboard
Removes the given MenuProvider from the helper.